﻿using DotNetty.Buffers;
using DotNetty.Codecs.Http.WebSockets;
using DotNetty.Common.Utilities;
using DotNetty.Transport.Channels;
using System;
using System.Text;
using System.Threading.Tasks;

namespace JGSY.DotNetty.Server.CoreImpl
{
    // 假设基类为自定义的 WebSocket 处理基类，若不存在可调整为合适的基类
    public class WebSocketHandler : HttpHandlerContext  // 或其他正确的基类
    {
        

        // 修正方法名拼写（Hander -> Handle）
        public async override Task HandlerAsync(IChannelHandlerContext ctx, IByteBufferHolder byteBufferHolder)
        {
            // 处理 WebSocketFrame 类型的消息
            await HandlerAsync<WebSocketFrame>(ctx, byteBufferHolder, HandlerRequestAsync);
        }
        #region 私有方法
        /// <summary>
        /// 处理请求
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="frame"></param>
        /// <returns></returns>
        private async Task HandlerRequestAsync(IChannelHandlerContext ctx, WebSocketFrame frame)
        {
            await Task.Run(() => { });
        }
        #endregion
    }
}

 